////////////////////////////////////////////////////////////////////////////////
// Filename: cameraclass.h
////////////////////////////////////////////////////////////////////////////////
#ifndef _AREA_H_
#define _AREA_H_

//////////////
// INCLUDES //
//////////////
#include <windows.h>
#include <xnamath.h>
#include <vector>

#include "Tools.h"


class Entity;
class Game;
class TiXmlElement;
class Scene;
class PointsLightsManager;
class ShadowMap;
struct PointLight;

class Area
{
public:
	Area();
	Area(const Area&);
	~Area();

	bool Initialize();
	void InitializeByXml(Scene* mSceneParent, TiXmlElement* areaElement);
	void Uninit();
	void Update(int pElapsedTime);
	void ResetPreRender();
	void PreRender(bool pDoLinkArea);
	void Render();
	//void ShadowRender(ShadowMap* pShadowMap);

	int GetId();

	bool IsInBoundingBox(XMFLOAT3 &position);
	void GetBoundingBox(BoundingBox &pBoundingBox);
	void CalculBoundingBox(bool pForce = false);
	void Link();

	Area* GetAreaByPosition(XMFLOAT3 &position);

	int GetSubAreaCount();

	bool IsRendering();
	bool IsRenderingFlag();
	void ResetIsRenderingFlag();
	void EventStartRendering();
	void EventStopRendering();
protected:
	Game* mGame;
	Scene* mSceneParent;

	int mId;

	std::vector<Entity*> mEntities;
	std::vector<Area*> mSubareas;
	std::vector<int> mSubareasId;
	std::vector<Area*> mLinkedAreas;
	std::vector<int> mLinkedAreasId;

	BoundingBox mBoundingBox;
	bool mBoundingBoxIsCompute;

	bool mIsRenderingFlag;
	bool mIsRendering;

	std::vector<PointLight*> mPointsLightsList;
	PointsLightsManager* mPointsLightsManager;

};
#endif